package homeWorkDay03;

import java.io.*;
import java.util.Scanner;

public class Txte4 {
    public static void main(String[] args) throws FileNotFoundException {
        //输出流
        FileOutputStream fos = new FileOutputStream("pw.txt");
        //转换流 将字节流转换为字符流  字节流不能直接转换成字符流 要用到转换流
        OutputStreamWriter osw = new OutputStreamWriter(fos);
        //字符缓冲流
        BufferedWriter bw = new BufferedWriter(osw);
        //字符输出流
        PrintWriter pw = new PrintWriter(bw, true);
        Scanner scanner = new Scanner(System.in);
        System.out.println("请开始输入内容");
        while (true) {
            String str = scanner.nextLine();
            if ("exit".equals(str)) {
                break;
            }
            pw.println(str);
        }
        pw.close();
    }
}
